#define _CRT_SECURE_NO_WARNINGS 1
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int N = 50;
int a[N];

int main() {
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    string s = "2022";
    for (int i = 0; i < s.size(); i++) {
        if (s[i] >= '0' && s[i] <= '9') a[i] = s[i] - '0';
        else a[i] = s[i] - 'A' + 10;
    }
    ll x = 0;
    for (int i = 0; i < s.size(); i++) {
        x = x * 9 + a[i];
    }
    cout << x << '\n';
    return 0;
}